package ace.module.upms.oauth2.sdk.core.feign.impl;

import ace.cmp.openfeign.security.oauth2.core.config.FeignInternalServerOauth2SecurityConfig;
import ace.module.common.api.annotation.ApiRemoteProxyPriority;
import ace.module.oauth2.server.api.model.dto.ext.Oauth2AceUserInfoResultDto;
import ace.module.upms.oauth2.api.UpmsOauth2CallbackUserInfoApi;
import ace.module.upms.oauth2.api.input.UpmsOauth2CallbackUserInfoInput;
import ace.module.upms.oauth2.sdk.core.constant.SdkConstant;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 账户权限 oauth2 callback rpc contract.
 *
 * @author Caspar
 */
@FeignClient(
    name = "${spring.cloud.openfeign.client.upmsOauth2CallbackUserInfoFeign.name:" + SdkConstant.FEIGN_SERVICE_NAME + "}",
    contextId = "upmsOauth2CallbackUserInfoFeign",
    path = UpmsOauth2CallbackUserInfoFeign.PATH,
    configuration = FeignInternalServerOauth2SecurityConfig.class,
    primary = false
)
@ApiRemoteProxyPriority
public interface UpmsOauth2CallbackUserInfoFeign extends UpmsOauth2CallbackUserInfoApi {

  String PATH = "${spring.cloud.openfeign.client.upmsOauth2CallbackUserInfoFeign.path:/upms/oauth2/rpc}";

  @PostMapping("/getUserInfo")
  Oauth2AceUserInfoResultDto getUserInfo(@Valid @NotNull @RequestBody UpmsOauth2CallbackUserInfoInput input);
}
